package com.tankbattle.enums;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum TankTypeEnum {
    PLAYER, PLAYER_2, ORDINARY_ENEMY, FATTY_ENEMY, FATTY_MINI_ENEMY, QUICK_ENEMY;
    // 获取所有非玩家坦克类型
    private static final List<TankTypeEnum> ENEMY_TANKS = Arrays.stream(values())
            .filter(tank -> tank != PLAYER && tank != PLAYER_2)
            .collect(Collectors.toList());

    // 随机获取一个敌方坦克类型（不会返回 PLAYER 或 PLAYER_2）
    public static TankTypeEnum randomEnemyTank() {
        int randomIndex = (int) (Math.random() * ENEMY_TANKS.size());
        return ENEMY_TANKS.get(randomIndex);
    }
}
